const host = 'https://hwapi.juyunka.com/wan/';
const ajaxJson = function(url, data, fun) {
	// data.uid = uni.getStorageSync('uid');
	data.token = getApp().globalData.token;
	let result;
	uni.request({
		url: host + url,
		method: 'post',
		data: data,
		success: function(ret) {
			if (ret.data.code == 1000) {
				result = ret.data.data;
				fun(result);
			} else if (ret.data.code == 5001) {
				uni.reLaunch({
					url: '/pages/search/search.vue'
				})
			} else if (ret.data.code == 5003) {
				uni.navigateTo({
					url: '/pages/shopDetails/shopDetails.vue?goods_id='+ret.data.data+"&specs_id=''"
				})
			} else {
				uni.showToast({
					title: ret.data.message,
					icon: 'none',
					duration: 2000
				});
				return false;
			}
		}
	});
}
export default {
	host,
	ajaxJson,
}
